package com.qingke.xml;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;

public class SaxParser {
	public static List<Map<String,String>> saxParse(String uri,String nodename){
		SAXParserFactory factory = SAXParserFactory.newInstance();
		SAXParser parse;
		try {
			parse = factory.newSAXParser();
			SaxParserHandler myHandler = new SaxParserHandler(nodename);
			parse.parse(uri,myHandler);
			
		} catch (ParserConfigurationException | SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		return SaxParserHandler.getList();
	}
}
